package com.sq.partner.manager.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.sq.partner.manager.common.Result;
import com.sq.partner.manager.mybatis.model.FacadeAppForm;
import com.sq.partner.manager.mybatis.model.FacadeNewPayment;
import com.sq.partner.manager.mybatis.model.FacadePayment;
import com.sq.partner.manager.mybatis.model.FacadeTempPolicy;
import com.sq.partner.manager.mybatis.model.GatewayUser;

/**
 * 支付Service接口
 * 
 * @author zhouxiuxiu
 *
 */
public interface PayService {

    /**
     * 生成交易流水id
     * 
     * @param appno
     * @return
     * @throws Exception
     */
    public String generateTradingSerialNumber(String appno) throws Exception;

    /**
     * 
     * @param stagNo
     * @return
     * @throws Exception
     */
    public FacadeTempPolicy findPayFacadeTempPolicy(String stagNo)
            throws Exception;

    /**
     * 根据投保单号再次发起缴费确
     * 
     * @param cardNo
     * @param appNo
     * @param stagNo
     * @return
     * @throws Exception
     */
    public Result paymentConfirmAgain(String cardNo, String appNo,
            String stagNo) throws Exception;

    /**
     * 支付前较验(生效日期10分钟内 不能支付)
     * 
     * @param tp
     * @throws Exception
     */
    public void validateBeforePay(FacadeTempPolicy tp) throws Exception;

    /**
     * 新支付流程 2.无支付记录
     *
     * */
    public FacadePayment noPaymentRecord(FacadeTempPolicy tp, String userCode)
            throws Exception;
    
    /**
     * 新支付流程 2.无支付记录  对接新支付平台 helina 20190314
     *
     * */
    public FacadeNewPayment noNewPaymentRecord(FacadeTempPolicy tp, String userCode)
            throws Exception;

    /**
     * 更新支付信息表，出单系统暂存单表，出单系统投保单表
     */
    public boolean updateFacade(FacadePayment payment) throws Exception;
    
    /**
     * 更新支付信息表，出单系统暂存单表，出单系统投保单表  对接新支付平台  20190318 helina
     */
    public boolean updateFacadeNewPay(FacadeNewPayment newpayment) throws Exception;
    

    /**
     * 缴费确认
     * 
     * @param payment
     * @throws Exception
     */
    public Result updatePayCostCallBack(FacadePayment payment)
            throws Exception;
    
    /**
     * 缴费确认对接新支付平台 20190312 helina
     * 
     * @param newPayment
     * @throws Exception
     */
    public Result updateNewPayCostCallBack(FacadeNewPayment newPayment)
            throws Exception;

    /**
     * 新支付流程 4.未支付状态
     *
     * @param facadepayment
     * @return
     * @throws Exception
     */
    public FacadePayment noPaymentStatus(FacadePayment facadepayment) throws Exception;
    
    /**
     * 新支付流程 4.未支付状态 对接新支付平台 helina 20190314
     *
     * @param facadeNewpayment
     * @return
     * @throws Exception
     */
    public FacadeNewPayment noNewPaymentStatus(FacadeNewPayment facadeNewPayment) throws Exception;

    /**
     * 新支付流程 5.已支付状态
     *
     * */
    public List<FacadeAppForm> alreadyPaymentStatus(String stagNo)
            throws Exception;
    /**
     * 出库用的支付查询缴费接口
     * @param facadepayment
     * @return
     * @throws Exception
     */
    public FacadePayment noPaymentStatusForOut(FacadePayment facadepayment) throws Exception;
    
    /**
     * 出库缴费完成更新出库表状态
     * @param payId
     * @param statusBef
     * @param statusAft
     * @throws Exception
     */
    public void updatCommamtInfo(String payId,
            String statusBef, String statusAft) throws Exception;
    
    /**
     * 出库缴费完成更新卡单表状态
     * @param payId
     * @param statusBef
     * @param statusAft
     * @throws Exception
     */
    public void updateStatusByCommamtId(String payId, String statusBef,
            String statusAft) throws Exception;
    
    /**
     * 根据出库ID查找出库人数字工号
     * @param payId
     * @return
     * @throws Exception
     */
    public Map<String, String> getEmployeeNoByCommamtId(String payId) throws Exception;
    
    /**
     * 根据条件查询payment信息 helina 20190318
     * @param map
     * @return
     * @throws Exception
     */
    public FacadeNewPayment queryNewPayment(HashMap<String, String> map) throws Exception;
    
    
    /**
     * 缴费确认失败后再次发起缴费确认 对接新支付平台 20190419
     * @param cardNo
     * @param appNo
     * @param stagNo
     * @return
     * @throws Exception
     */
    public Result newPaymentConfirmAgain(String cardNo, String appNo, String stagNo) throws Exception;
    
}
